home *** CD-ROM | disk | FTP | other *** search
- From: Kevin A. Sapp <sapp%sawdust@sawdust.ssc.gov>
- Subject: Objective-C Source
- To: gsk@marble.com
- Date: Wed, 20 Jan 93 16:29:03 CST
- Mailer: Elm [revision: 66.25]
-
-
- Geoffrey,
-
- I have some source for what I call "instance archiving". It is really
- a random access, variable record length, with recycling file. It works
- in much the same way that NeXT's archiving does with -write and -read
- methods (but does not contain the ENTIRE CLASS info).
-
- At this point the code can store variable sized objects along with their
- class and some other stuff. When I get some time I am going to create
- a - readAndCreateAtRecordNumber: method which would first read the class
- perform an alloc and then call the objects -read/writes (I think I called
- them readIt and writeIt [WOW]). It is not fully tested or fully featured.
-
- A sample read is:
-
- @interface Stuff:Object
- {
- int anInt;
- float aFloat;
- double aDouble;
- }
- ...
-
- - (BOOL)readIt:stream
- {
- [stream readInt:&anInt]; //this is a BOOL not checked
- [stream readFloat:&aFloat]; //this is a BOOL not checked
- [stream readDouble:&aDouble]; //this is a BOOL not checked
- return YES;
- }
-
- support is provided for 8,16,32 bit integers, 32 and 64 bit floats,
- char strings and mem buffers(I think).
-
- I have also performed some work on my own encoding and decoding of structures
- and classes. The code uses an encode string (ala NeXT, does GNU support
- this ?, THEY SHOULD!!!), parses it and puts it in a KNOWN format.
-
- Wouldn't it be nice to say [stream writeObject:anObject at:recordNumber]
- and the object supports an -encodeString method that could be queried so
- that NO -read or -write methods have to be written? and is portable to
- any processor (big or little endian, different structure packing...)
-
- The code is available, just let me know.
- (214)708-3345
-
- --
- ----------------------------------------------------------------------------
- Kevin A. Sapp "A civilization depends upon the quality
- Superconducting Super Collider of individual it creates" (Dune)
- sapp@sawdust.ssc.gov :>( please NO NeXT mail
-
-
-